<?php

/**
 * Contact filter form base class.
 *
 * @package    HomeShow
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseContactFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'firstName'       => new sfWidgetFormFilterInput(),
      'lastName'        => new sfWidgetFormFilterInput(),
      'emailAddress'    => new sfWidgetFormFilterInput(),
      'active'          => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'type'            => new sfWidgetFormFilterInput(),
      'shippingAddress' => new sfWidgetFormFilterInput(),
      'birthDate'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'firstName'       => new sfValidatorPass(array('required' => false)),
      'lastName'        => new sfValidatorPass(array('required' => false)),
      'emailAddress'    => new sfValidatorPass(array('required' => false)),
      'active'          => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'type'            => new sfValidatorPass(array('required' => false)),
      'shippingAddress' => new sfValidatorPass(array('required' => false)),
      'birthDate'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('contact_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contact';
  }

  public function getFields()
  {
    return array(
      'id'              => 'Number',
      'firstName'       => 'Text',
      'lastName'        => 'Text',
      'emailAddress'    => 'Text',
      'active'          => 'Boolean',
      'type'            => 'Text',
      'shippingAddress' => 'Text',
      'birthDate'       => 'Date',
    );
  }
}
